package com.jeewms.www.tms;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;

public class alertMainActivity extends Activity{

        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_login);

            Intent intent = new Intent(this, AutoReceiver.class);
            intent.setAction("VIDEO_TIMER");
            // PendingIntent这个类用于处理即将发生的事情 
            PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent, 0);
            AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
            // AlarmManager.ELAPSED_REALTIME_WAKEUP表示闹钟在睡眠状态下会唤醒系统并执行提示功能，该状态下闹钟使用相对时间
            // SystemClock.elapsedRealtime()表示手机开始到现在经过的时间
            am.setRepeating(
                    //AlarmManager.ELAPSED_REALTIME_WAKEUP,
                    AlarmManager.RTC_WAKEUP,
                    SystemClock.elapsedRealtime(), 60000, sender);
        }
    }


